<%--
  Created by IntelliJ IDEA.
  User: 甲乙饼叮叮
  Date: 2019/10/4
  Time: 15:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>个人中心</title>
    <link rel="Shortcut Icon" href="../imgs/Kat-icon.png">
    <!-- 引入bootstrap框架的样式文件 -->
    <link rel="stylesheet" href="../plugins/bootstrap/css/bootstrap.css" type="text/css">
    <link type="text/css" href="../css/personal.css" rel="stylesheet" />
    <link rel="stylesheet" href="../css/head.css">
    <link rel="stylesheet" href="../css/alert.css">
</head>

<body>
<!-- 导航开始 -->
<%@ include file="../nav/nav.jsp"%>
<!-- 导航结束 -->
<!-- 个人中心视图 -->
<a name="per"></a>
<div class="personal">
    <div class="container">
        <div class="row">
            <div class="col-xs-2 col-sm-2 col-md-2" id="left">
                <div class="title">
                    <span>个人中心</span>
                </div>
                <div id="outer">
                    <!-- <div class="container-fluid"> -->
                    <ul id="tab" class="nav navbar-nav">
                        <li><a href="${pageContext.request.contextPath}/personal/user" class="glyphicon glyphicon-user">&nbsp;<span>我的信息</span></a>
                        </li>
                        <li><a href="${pageContext.request.contextPath}/personal/order"
                               class="glyphicon glyphicon-list-alt">&nbsp;<span>挂号订单</span></a></li>
                        <li><a href="${pageContext.request.contextPath}/personal/record"
                               class="glyphicon glyphicon-calendar">&nbsp;<span>就诊记录</span></a></li>
                        <li><a href="${pageContext.request.contextPath}/personal/medical"
                               class="glyphicon glyphicon-tasks">&nbsp;<span>我的病历</span></a>
                        </li>
                        <li><a href="${pageContext.request.contextPath}/personal/safetys"
                               class="glyphicon glyphicon-tasks">&nbsp;<span>账号安全</span></a>
                        </li>
                        <li class="active"><span class="glyphicon glyphicon-tree-deciduous">&nbsp;就诊管理</span>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="col-xs-9 col-sm-9 col-md-9" id="righter">
                <div class="title">
                    <span><img src="${pageContext.request.contextPath}/imgs/weblogo.png" alt="" style="width: 2%">知医治</span>
                </div>
                <div id="content">
                    <div style="display:block;" class="tabpage">
                        <h3 class="glyphicon glyphicon-grain">添加就诊人</h3>
                            <div class="counts" style="margin-left: 250px;">
                                <div class="texts">
                                    <span>姓&nbsp;&nbsp;&nbsp;名:</span>&nbsp;&nbsp;&nbsp;
                                    <input type="text" name="names" onblur="codeName()" id="names">
                                    &nbsp;<span id="namesSpan"></span>
                                </div>
                                <div class="texts" >
                                    <span>证件号:</span>&nbsp;&nbsp;&nbsp;
                                    <input type="text" name="card" onblur="codeCard()" id="card">
                                    &nbsp;<span id="cardSpan"></span>
                                </div>
                                <div class="texts">
                                    <span>性&nbsp;&nbsp;&nbsp;别:</span>&nbsp;&nbsp;&nbsp;
                                    <input type="text" name="sexs" onblur="codeSex()" id="sex">
                                    &nbsp;<span id="sexSpan"></span>
                                </div>
                                <div class="texts">
                                    <span>年&nbsp;&nbsp;&nbsp;龄:</span>&nbsp;&nbsp;&nbsp;
                                    <input type="text" name="ages" onblur="codeAge()" id="ages">
                                    &nbsp;<span id="agesSpan"></span>
                                </div>
                                <div>&nbsp;&nbsp;&nbsp;
                                    <button type="button" onclick="location.href='${pageContext.request.contextPath}/personal/newview'" style="color: white">取消</button>&nbsp;&nbsp;&nbsp;
                                    <button type="button" onclick="tonewin()" class="alert-api-button alert-btn1" style="color: white">保存</button>&nbsp;&nbsp;&nbsp;
                                    <button type="button" onclick="toreg()" class="alert-api-button alert-btn1" style="color: white">保存并前往挂号</button>
                                </div>
                            </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>

    //验证姓名
    function codeName(){
        return codedata("names",/^[\u4e00-\u9fa5]{2,16}$/);
    }
    //验证身份证号码
    function codeCard(){
        return codedata("card",/^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/);
    }
    //验证性别
    function codeSex(){
        return codedata("sex",/^[\u4e00-\u9fa5]{1,2}$/);
    }
    //验证年龄
    function codeAge(){
        return codedata("ages",/^(?:0|[1-9][0-9][0-9]?|9)$/);
    }
    //封装
    function codedata(a,reg1){
        //获取用户的用户信息
        var user = document.getElementById(a).value;
        var span = document.getElementById(a+"Span");
        var alt = document.getElementById(a).alt;
        //创建校验规则
        var reg=reg1;
        //校验
        if(user==""|| user==null){
            span.innerHTML=alt+"不能为空";
            return false
        }else if(reg.test(user)){
            span.innerHTML=alt+"ok";
            return true
        }else{
            span.innerHTML=alt+"不符合规则";
            return false
        }
    }
    function tonewin() {
        codeName();
        codeCard();
        codeSex();
        codeAge();
//        return codeName()&&codeCard()&&codeSex()&&codeAge();

        var names =document.getElementById("names").value;
        var card =document.getElementById("card").value;
        var sexs =document.getElementById("sex").value;
        var ages =document.getElementById("ages").value;

        if( names ==""|| names== null){
            return false;
        }
        if(card == null || card ==""){
            return false;
        }
        if(sexs == null || sexs ==""){
            return false;
        }
        if(ages == null || ages ==""){
            return false;
        }
        location.href ="/treatment/personal/newinsite?names="+names+"&card="+card+"&sexs="+sexs+"&ages="+ages;
    }
    function toreg() {
        codeName();
        codeCard();
        codeSex();
        codeAge();
//        return codeName()&&codeCard()&&codeSex()&&codeAge();
        var names =document.getElementById("names").value;
        var card =document.getElementById("card").value;
        var sexs =document.getElementById("sex").value;
        var ages =document.getElementById("ages").value;
        if( names ==""|| names== null){
            return false;
        }
        if(card == null || card ==""){
            return false;
        }
        if(sexs == null || sexs ==""){
            return false;
        }
        if(ages == null || ages ==""){
            return false;
        }
        location.href ="/treatment/personal/toreg?names="+names+"&card="+card+"&sexs="+sexs+"&ages="+ages;
    }
</script>
<!-- bootstrap中的js插件依赖于jquery框架,所以必须先引入jquery的js文件 -->
<script src="../plugins/jquery/jquery.min.js"></script>
<!--引入bootstrap的js文件-->
<script src="../plugins/bootstrap/js/bootstrap.js"></script>
<!-- 引入alert的js文件 -->
<script src='../js/alert.js'></script>

</body>

</html>
